//美丽的区间 二分查找
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5;
ll a[N];
ll prefix[N];
ll n=0,s=0;

ll check(ll mid)
{
	ll sum = 0;
	int l = 1;
	int r = mid;
	while(r <= n)
	{
		sum = max(sum,prefix[r] - prefix[l - 1]);
		l++;
		r++;
	}
	return sum;
}

int main()
{
	
	cin >> n >> s;
	for(int i = 1; i <= n; i++)
		cin >> a[i];
	
	for(int i = 1; i <= n; i++)
		prefix[i] = prefix[i-1] + a[i];
	
	ll l = 0;
	ll r = n+1;
	while(l + 1 != r)
	{
		ll mid = (l+r)/2;
		if(check(mid) >= s)
			r = mid;
		else
			l = mid;
	}
	if(r <= n)
		cout << r;
	else
		cout << 0;
	return 0;
}
